package com.blast.comicsisland.fragment;

import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.blast.comicsisland.R;
import com.blast.comicsisland.utils.ShareUtil;

/**
 * 我的 Fragment 均为Button按钮 该版本只提供布局展示
 * 上方包含Settings 按钮 点击跳转至SettingActivity
 */
public class ProfileFragment extends Fragment implements View.OnClickListener {

    private LinearLayout share;
    public ProfileFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View ret = inflater.inflate(R.layout.fragment_profile, container, false);
        share = (LinearLayout) ret.findViewById(R.id.share);
        share.setOnClickListener(this);
        return ret;
    }


    @Override
    public void onDetach() {
        super.onDetach();
    }


    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.share){
            ShareUtil.shareString(getActivity(), Environment.getExternalStorageDirectory() + "/icon.png");
        }
    }
}
